<!DOCTYPE html>
<html lang="en">
<head>
	<title>Calendar - Localization</title>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<meta name="description" content="" />
	<meta name="keywords" content="" />
	<meta name="author" content="ComponentOne" />
	
	<link href="../../themes/rocket/jquery-wijmo.css" rel="stylesheet" type="text/css" />
	
	<script src="../../external/jquery-1.8.0.min.js" type="text/javascript"></script>
	<script src="../../external/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script>
	<link href="../../themes/wijmo/jquery.wijmo.wijcalendar.css" rel="stylesheet" type="text/css" />
	<script src="../../external/globalize.min.js" type="text/javascript"></script>
	<script src="../../external/cultures/globalize.cultures.js" type="text/javascript"></script>
	<script src="../../wijmo/jquery.wijmo.wijpopup.js" type="text/javascript"></script>
	<script src="../../wijmo/jquery.wijmo.wijcalendar.js" type="text/javascript"></script>
	<script type="text/javascript">

		function sortByName(map) {
			// converts a dictionary into a sorted dictionary based on obj.name
			var arr = [];
			$.each(map, function (name, value) {
				arr.push(value);
			});
			arr.sort(function (a, b) {
				return a.name < b.name ? -1 : 1;
			});
			return arr;
		}

		$(function () {
			$("#calendar1").wijcalendar();

			var sortedCultures = sortByName(Globalize.cultures);
			var list = $(".cultures");

			$.each(sortedCultures, function (i, culture) {
				$("<option/>", {
					value: culture.name,
					text: culture.name + ": " + (culture.englishName || "Invariant")
				}).appendTo(list);
			});
			list.val("en");
			list.bind("change keyup", function () {
				culture = list.val();
				$("#calendar1").wijcalendar({ culture: culture });
			});
		});
	
	</script>
</head>
<body class="demo-single">
	<div class="container">
		<div class="header">
			<h2>
				Localization</h2>
		</div>
		<div class="main demo">
			<!-- Begin demo markup -->
			<div id="calendar1">
			</div>
			<!-- End demo markup -->
			<div class="demo-options">
				<!-- Begin options markup -->
				<div class="option-row">
					<label for="cultures">
						Culture</label>
					<select class="cultures">
					</select>
				</div>
				<!-- End options markup -->
			</div>
		</div>
		<div class="footer demo-description">
			<p>
			This sample illustrates how to set the localization of the wijcalendar using the culture option. 
			</p>
		</div>
	</div>
</body>
</html>
